using System;
using System.Collections.Generic;
using System.Linq;

namespace LocalDnsSdk.Commands
{
    public class CommandParseResult
    {
        public string Name { get; set; } = string.Empty;
        public string[] Args { get; set; } = Array.Empty<string>();
    }

    public static class CommandParser
    {
        public static CommandParseResult Parse(string? input)
        {
            if (string.IsNullOrWhiteSpace(input)) return new CommandParseResult();
            var parts = input.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (parts.Length == 0) return new CommandParseResult();
            return new CommandParseResult
            {
                Name = parts[0].ToUpperInvariant().Replace('-', '_'),
                Args = parts.Skip(1).ToArray()
            };
        }
    }
}